import echarts from "echarts";

import macarons from "./macarons.js";
import dark from "./dark.js";
import infographic from "./infographic";
import roma from "./roma";
import shine from "./shine";
import vintage from "./vintage";
import reachDark from "./reach-dark.js";
import reachLight from "./reach-light.js";
import { DEFAULT_THEME } from "../setting";

let defaultTheme = "dark";

const $_$themeList = [
    { name: "macarons", theme: macarons },
    { name: "dark", theme: dark },
    { name: "infographic", theme: infographic },
    { name: "roma", theme: roma },
    { name: "shine", theme: shine },
    { name: "vintage", theme: vintage },
    { name: "reachDark", theme: reachDark },
    { name: "reachLight", theme: reachLight }
];

!(function() {
    if (typeof DEFAULT_THEME === "string") {
        defaultTheme = DEFAULT_THEME;
    } else if (typeof DEFAULT_THEME === "object") {
        defaultTheme = DEFAULT_THEME.name || "default";
        $_$themeList.push({ name: defaultTheme, theme: DEFAULT_THEME });
    }
})();

export const THEME = defaultTheme;

export const themeList = $_$themeList;

export default echarts;
